<%@ page import="com.dingpeikeji.quickdeer.modules.rentproduct.entity.TDemands" contentType="text/html;charset=UTF-8" %>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<%@ include file="/WEB-INF/views/layouts/head.jsp" %>
<c:set var="REACTSTATUS_WAIT" value="<%=TDemands.REACTSTATUS_WAIT %>" />
<c:set var="REACTSTATUS_DONE" value="<%=TDemands.REACTSTATUS_DONE %>" />
<c:set var="REACTSTATUS_SURE" value="<%=TDemands.REACTSTATUS_SURE %>" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>个人中心</title>

<link href="${ctxStatic }/xiake/css/list.css" rel='stylesheet' type='text/css' />
<link href="${ctxStatic }/index/css/Personal.css" rel="stylesheet">
<script src="${ctxStatic }/jquery/jquery-1.8.3.min.js"></script>
<script src="${ctxStatic }/index/js/Personal.js"></script>
<script src="${ctxStatic }/xiake/js/slider.js"></script>
<script src="${ctxStatic }/xiake/js/jquery.reveal.js"></script>
<script src="${ctxStatic }/xiake/js/switch.js"></script>
<script type="text/javascript">
	$(function(){
		var keyVal = "${message}";
		if(keyVal.length!=0){  
			alert(keyVal);
		}
	
		var keyVal1 = "${message1}";
		if(keyVal1.length!=0){  
			alert(keyVal1);
		}
		var keyVal2 = "${sessionScope.mes}";
		if(keyVal2.length!=0){  
			alert(keyVal2);
		}
		$('#inf_safe').trigger('click');
		var tabid  = "${param.id}";
		//既触发了a标签的点击事件，又触发了页面跳转   
		if(tabid.length>0){
			document.getElementById(tabid).click();  
		}
		$("#tab").click(function(){
			window.location.href = '${ctxFront}/orders/orderList';
			//$("#searchForm").submit();
		})
		$(".backmoney").click(function(){
			$value = $(this).attr("value");
			$.post("${ctxFront}/sms/checkBackTime","orderid="+$value,function(d){
				if(d==1){//已过发车时间
					alert("已过发车时间,无法退单");
				}else{
					window.location.href = "${ctxFront}/pay/backMoneyPage?orderid="+$value;
				}
			}); 
		})
		$("#fp").click(function(){
			window.location.href = "${ctxFront }/usersRcpt/ordersList";
		})
		$("#search").click(function(){
			$("#searchForm").submit();
		})
		$('#status').change(function(){
			$('#searchForm').submit();
		}); 
		
		$("#subBtn").click(function(){
			$('#modifyPwdForm').submit()
		});
	});
	function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
	//计算开票金额
	function JSfpmoney()
	{
		var allmoney=0;
		/* var a=0;//超时长
		var b=0;//超公里
		var c=0;//司机食宿
		var d=0;//三者相加 */
		$(".fp_list table tr td").find("input").each(function(){
			var ck=$(this).attr("checked");
			if(ck=="checked")
			{
				$("#outtimefee").val(0);
				$("#outkmsfee").val(0);
				$("#dirverfee").val(0);
				 var a=$(this).parent().parent().find(".fp").find(".xs1").val();
				 var b=$(this).parent().parent().find(".fp").find(".xs2").val();
				 var c=$(this).parent().parent().find(".fp").find(".xs3").val();
				 if(isNaN(a)||a==''){
					a= 0; 
				 }
				 if(isNaN(b)||b==''){
					b= 0;
				 }
				 if(isNaN(c)||c==''){
					c= 0; 
				 }
				 var d = parseFloat(a)+parseFloat(b)+parseFloat(c);
				var v=$(this).parent().parent().find(".fpmoney").html();
				var sum = 0;
				if(d==''||isNaN(d) ){
					sum = parseFloat(v);
				}else{
					$("#outtimefee").val(a);
					$("#outkmsfee").val(b);
					$("#dirverfee").val(c);
					sum = parseFloat(v)+parseFloat(d);
				}
				allmoney+=sum;
			}
		});
		$(".labelmoney").html(allmoney);
		$("#money").val(allmoney);
	}
	function check() {
		if($("#money").val()==''||$("#money").val==null){
			alert("请至少选择一个订单");
			return false;
		}else{
			$('#inputForm').submit();
		}
	}
</script>
</head>
<%session.removeAttribute("mes");%>
	<body>
     <div id="me-con-tab">
		<div class="member">
			<div class="member_1">
				<h4>会员中心</h4>
			</div>
			<div class="container">

				<ul class="tabs" style="float: left">
					<li id="tab">
						<a href="#tab1">我的订单</a>
					</li>
					<li id="fp">
						<a href="#tab2">关于发票</a>
					</li>
					<li id='info'>
						<a href="#tab3">个人中心</a>
					</li>
				</ul>

				<div class="table_container">
					<div id="tab1" class="tab_content" style="float: right;">
			<form id="searchForm" action="${ctxFront}/orders/orderList" method="post">
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
						<div class="order_for">
							<div class="member_2">
								<dl>
									<dd>
 <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>									
<span>订单号：</span>&nbsp;<input type="text" name="orderid" value="${orders.orderid }" placeholder="请输入订单号" class="order">
<span style="margin-left: 10px;">预定日期：</span>&nbsp;
<input type="text" id="createDateQueryStart" name="createDateQueryStart" maxlength="20" readonly 
   placeholder="" class="order_1 Wdate" value="${orders.createDateQueryStart }"
   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,maxDate:'#F{$dp.$D(\'createDateQueryEnd\')}'});" class="order_1">
	 - <input type="text" id="createDateQueryEnd" name="createDateQueryEnd" maxlength="20" readonly
    placeholder="" class="order_2 Wdate" value="${orders.createDateQueryEnd }"
	onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,minDate:'#F{$dp.$D(\'createDateQueryStart\')}'});">
	<select name="ordertype">
	<option value="" >全部类型</option>
	<option value="${ORDER_TYPE_RENTPRODUCT_DAY }" ${orders.ordertype == ORDER_TYPE_RENTPRODUCT_DAY?'selected':'' }>按天包车</option>
	<option value="${ORDER_TYPE_RENTPRODUCT_TRAVEL }" ${orders.ordertype == ORDER_TYPE_RENTPRODUCT_TRAVEL?'selected':'' }>旅游包车</option>
	<option value="${ORDER_TYPE_RENTPRODUCT_AIRPLANE }" ${orders.ordertype == ORDER_TYPE_RENTPRODUCT_AIRPLANE?'selected':'' }>接送机</option>
	<option value="${ORDER_TYPE_RENTPRODUCT_CUSTOM }" ${orders.ordertype == ORDER_TYPE_RENTPRODUCT_CUSTOM?'selected':'' }>定制包车</option>
    </select>
	<input class="inquiry" type="button" value="查询" onclick="$('#searchForm').submit();">

</dd>
								</dl>
							</div>

							<div class="my-dig"></div>

							<div>

								<div class="table_box">
									<table cellpadding="0" cellspacing="0">
										<tr class="order_tbox">
											<th>订单名称</th>
											<th>行程/有效期</th>
											<th>总金额</th>
											<th>
												<select name="orderstatus" id="status">
						<option value="">全部</option>
						<option value="${TORDERS_STATUS_NO_PAY }" ${orders.orderstatus == TORDERS_STATUS_NO_PAY?'selected':'' }>未支付</option>
						<option value="${TORDERS_STATUS_PAY }" ${orders.orderstatus == TORDERS_STATUS_PAY?'selected':'' }>已支付</option>
						<option value="${TORDERS_STATUS_BACK }" ${orders.orderstatus == TORDERS_STATUS_BACK?'selected':'' }>已取消</option>
						<option value="${TORDERS_STATUS_CANCEL }" ${orders.orderstatus == TORDERS_STATUS_CANCEL?'selected':'' }>已作废</option>
												</select>
											</th>
											<th>操作</th>
										</tr>
						 <c:forEach items="${page.list}" var="orders">				
										<tr class="tit_o">
											<td colspan="5">
												<div class="tito_cc">
													<span class="date_le">订单号码：${orders.orderid}</span>
													<span class="time_ri">订单日期：<fmt:formatDate value="${orders.createDate }" pattern="yyyy-MM-dd HH:mm:ss"/></span>
												</div>
											</td>
										</tr>
										<tr class="order_f">
											<td>
												${orders.ordername }
											</td>
											<td>
												<fmt:formatDate value="${orders.departdate }" pattern="yyyy-MM-dd HH:mm"/>
											</td>
											<td>￥${orders.dueamount}</td>
											<td><c:if test="${orders.orderstatus == TORDERS_STATUS_PAY}">已支付</c:if>
					<c:if test="${orders.orderstatus == TORDERS_STATUS_NO_PAY}">未支付</c:if>
					<c:if test="${orders.orderstatus == TORDERS_STATUS_BACK}">
						已取消<c:if test="${orders.settlereason == '5'}">（更换车队）</c:if>
					</c:if>
					<c:if test="${orders.orderstatus == TORDERS_STATUS_CANCEL}">已作废</c:if></td>
											<td class="to_void">
											<c:if test="${orders.orderstatus == TORDERS_STATUS_NO_PAY}">
                    <c:if test="${orders.ordertype == 'c'}">
                    <a target="_blank" 
                    href="${ctxFront }/rentproduct/demands/list">支付</a>	
                    </c:if>
                    <c:if test="${orders.ordertype != 'c'}">
					<a target="_blank" href="${ctxFront}/pay/payWay?orderid=${orders.orderid}&boardaddrfc=${orders.realscheOff.siteid }&offaddrfc=${orders.realscheBoard.siteid }">支付</a>
                    </c:if>
					<a href="javascript:void(0)" class="dx1_cel" value="${orders.orderid}">取消</a>
				</c:if>
				<c:if test="${orders.orderstatus == TORDERS_STATUS_PAY}">
					<c:if test="${orders.ordertype == ORDER_TYPE_REALSCHE_SELF_TRAVEL}">
						<a href="${ctxFront}/realsche/backMoney?orderid=${orders.orderid}">退单</a>
					</c:if>
					<c:if test="${orders.ordertype ne ORDER_TYPE_REALSCHE_SELF_TRAVEL}">
						<%-- <a href="${ctxFront}/pay/backMoney?orderid=${orders.orderid}">退单</a> --%>
						<a href="javascript:void(0)" class="backmoney" value="${orders.orderid}">退单</a>
					</c:if>
				</c:if>
				<a href="${ctxFront}/orders/orderDetail?orderid=${orders.orderid}" target="_blank">查看</a>

											</td>
										</tr></c:forEach>
									</table>
									<div style="text-align: center;">
		<div class="pagination  font_normal_size"  style="width: 100%;">${page.html}</div></div>
								</div>

							</div>

						</div>
</form>
					</div>
					<div id="tab2" class="tab_content" style="float: right;">
						<div class="inroice">
							<dl>
								<dd style="padding-top: 10px">
									<span class="draw">可开发票列表</span>
									<div class="record">
										<a href="${ctxFront }/usersRcpt/history">开票记录</a>&nbsp;&nbsp;&nbsp;
										<a href="${ctxFront }/usersRcpt/userInfo">开票信息</a>
									</div>

								</dd>
								<dd style="padding-top: 20px">
									<span class="selecter">已选金额:&nbsp;&nbsp;</span><span class="money_1 labelmoney">0.00</span>
									<a href="javascript:check();" class="query" id="kp">立即开票</a>
								</dd>
							</dl>
						</div>
						<div class="check_all fp_list">
			<form id="inputForm" action="${ctxFront }/usersRcpt/userInfo" method="post">
             <input type="hidden" name="outtimefee" id="outtimefee">
             <input type="hidden" name="outkmsfee" id="outkmsfee">
             <input type="hidden" name="dirverfee" id="dirverfee">
             <input type="hidden" name="money" id="money">
             <input type="hidden" name="buttonname" value="提交">
							<table class="check_all_1">

								<tr class="back-color">
									<td style="padding-left: 35px">
										
									</td>
									<td>全选</td>
									<td>订单号</td>
									<td>订单名称</td>
									<td>可开票金额</td>
									<td>支付时间</td>
									<td>超时长费</td>
									<td>超公里费</td>
									<td>司机食宿费</td>

								</tr>
		<c:forEach items="${ordersList}" var="orders">
								<tr class="border_0" style="height: 50px">
									<td style="padding-left: 35px"></td>
									<td>
				    			<input type="radio" class="selectChild" value="${orders.orderid }" name="rcptIds" onclick="JSfpmoney()">
				    			</td>

									<td>${orders.orderid }</td>
									<td>${orders.ordername }</td>
									<td class="fpmoney">${orders.dueamount}</td>
									<td><fmt:formatDate value="${orders.paydate }" pattern="yyyy-MM-dd"/></td>
									<td class="fp">
										<input type="number" placeholder="请填写费用" class="overtime_1 xs1" min="0" name="outtimefee"/>
									</td>
									<td class="fp">
										<input type="number" placeholder="请填写费用" class="overtime_1 xs2" min="0" name="outkmsfee">
									</td >
									<td class="fp">
										<input type="number" placeholder="请填写费用" class="overtime_1 xs3" min="0" name="dirverfee">
									</td>

								</tr>
								<tr class="my-bor">
									<td colspan="9"></td>
								</tr>

								<div style="background-color: red">

								</div>
</c:forEach>
							</table></form>
						</div>
						<div class="rule">
							<h5 class="rule_0">开票规则:</h5>
							<h6>1.开票内容仅支持代办租车费，发票类型仅支持增值税普通发票。</h6>
							<h6>2.支持线下收费开票，司机食宿、超公里费、超时费均可开票。</h6>
							<h6>3.单次申请开票满1000元包邮，不满1000元邮费到付，暂不支持港澳台包邮。</h6>
							<h6>4.开具发票需提供：发票抬头、纳税人识别号（企业必填）、收件人及电话、邮寄地址、邮编。</h6>
							<h6>5.增值税普通发票我们将在3-7个工作日寄出。</h6>
							<h6>6.因个人原因导致发票退回重开，所产生的往返快递费用将由您自行承担。</h6>

						</div>

					</div>
                     <div id="tab3" class="tab_content" style="float: right;">
						<ul class="tabs_0">
							<li>
								<a href="#tab4">信息设置</a>
							</li>&nbsp;&nbsp;&nbsp;
							<li>
								<a href="#tab5">密码重置</a>
							</li>
						</ul>
						<div class="sor"></div>

						<div id="tab4" class="tabs_content">
							<div class="set">
				<form id="modifyInfoForm" action="${ctxFront }/modifyInfo" method="post">
				<input type="hidden" name="id" value="${user.id }"/>
								<dl>
								<c:if test="${sessionScope.front_user.office.parent.id ne '3' }">
									<dd class="nickname">
										<span class="nickname_0">昵称&nbsp;：&nbsp</span>
										<input class="nickname_1" name="name" value="${user.name }" placeholder="4-10个字符，可由中英文字母、数字“－”组成">
									</dd>
									<dd class="mailbox">
										<span class="mailbox_0">邮箱&nbsp;：&nbsp</span>
										<input class="mailbox_1" name="email" value="${user.email }" id="email" placeholder="请输入邮箱">
									</dd>
									<dd class="contact">
										<span class="contact_0">联系电话&nbsp;：&nbsp</span>
										<input class="contact_1" name="mobile" value="${user.mobile }" disabled placeholder="请输入联系号码">
									</dd></c:if>
		<c:if test="${sessionScope.front_user.office.parent.id eq '3' }">
					 <dd class="nickname">
    <span class="nickname_0">企业名称&nbsp;&nbsp;</span>
    <input type="text" disabled value="${user.office.name }" class="nickname_1"/>
    </dd>
    <dd class="mailbox">
        <span class="mailbox_0">常用邮箱&nbsp;&nbsp;</span>
        <input type="text" name="email" value="${user.email }" class="nickname_1"/><span class="red">*</span>
    </dd>
    <dd class="contact">
        <span class="contact_0">默认经办人&nbsp;&nbsp;</span>
        <input type="text" name="name" value="${user.name }" class="nickname_1"/>
    </dd>
    <dd class="contact">
        <span class="contact_0">经办人手机&nbsp;&nbsp;</span>
        <input type="text" value="${user.mobile }" disabled class="nickname_1"/>
    </dd>
					</c:if>
								</dl>
								<input type="button" class="keep"  value="保存" onclick="$('#modifyInfoForm').submit();">
							</form></div>
						</div>

						<div id="tab5" class="tabs_content" style="display: none">
						 <form id="modifyPwdForm" action="${ctxFront }/modifyPwd" method="post">
							<div class="set">
								<dl>
									<dd class="orginal_password">
										<span class="nickname_0">原始密码&nbsp;：&nbsp</span>
										<input class="nickname_1" name="oldPassword" type="password" placeholder="">
									</dd>
									<dd class="new_password">
										<span class="mailbox_0">新密码&nbsp;：&nbsp</span>
										<input class="mailbox_1" name="newPassword" type="password" id="newPassword" placeholder="">
									</dd>
									<dd class="confirm_password">
										<span class="contact_0">确认密码&nbsp;：&nbsp</span>
										<input class="contact_1" type="password" name="repeatPassword" id="newPassword2" placeholder="">
									</dd>
								</dl>
								<input type="button" class="keep" value="保存" id="subBtn" >
								<span id="tips1"></span>
							</div></form>
						</div>
					</div>
				</div>

			</div>
		</div>
	</div>	
		<div id="tab_cel">
			<div class="tab-cel-box">
				   <p>您是否取消订单！</p>
				   <p>
				   	 <a href="javascript:void(0)" id="yes">是</a>
				   	 <a href="${ctxFront}/orders/orderList">否</a>
				   </p>
			</div>
		</div>
        <script>
        	$(function(){
        		$('.dx1_cel').click(function(){
        			$value = $(this).attr("value");
        			$("#yes").attr("href","${ctxFront}/pay/cancel?orderid="+$value); 
        			$('#tab_cel').show();
        		});
        			$('.tab-cel-box a').click(function(){
        			$('#tab_cel').hide();
        		})
        	})
        </script>
	</body>
</html>
<jsp:include page="/WEB-INF/views/layouts/foot.jsp"></jsp:include> 